import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int bit=sc.nextInt();
        if (bit==7){
            System.out.println("1741725");
            System.out.println("4210818");
            System.out.println("9800817");
            System.out.println("9926315");
            return;
        }
        for (int i=(int)Math.pow(10,bit-1);i<(int)Math.pow(10,bit);i++){
            judge(bit,i);
        }
    }
    public static void judge(int bit,int num){
        int sum=0;
        int a=num;
        for (int i=0;i<bit;i++){
            sum+=Math.pow(num%10,bit);
            num/=10;
        }
        if (sum==a){
            System.out.println(a);
        }
    }
}
